
PImage img1, img2;
float maxrad = 100; 
float ratio = 0;

void setup(){
  size(512,384);

  img1 = loadImage("voiture.jpg");
  img2 = loadImage("cascade.jpg");
  background(0);
  smooth();
  frameRate(60);
}

void draw(){
  for (int i=0; i<20; i++){ 
    float x = random(width);
    float y = random(height);
    float radius = random(2,maxrad);
    color c = img2.get((int)x,(int)y); 
    if (random(100)>ratio) c = img1.get((int)x,(int)y);
    noStroke();
    fill(color(red(c),green(c),blue(c),(100-maxrad)));
    ellipse(x,y,radius,radius);
    //ellipse(x,y,radius*0.75*0.75,radius*0.75*0.75);
    //ellipse(x,y,radius*0.50*0.50,radius*0.50*0.50);
    ellipse(x,y,radius*0.25*0.25,radius*0.25*0.25);
  }
  maxrad -= 0.1;

  if (maxrad <= 2){
    noLoop();
    print ("End Of File !");
  }
}
